package tpf.designer.pattern.course5.structure_pattern2.homework.jdk;

import org.junit.Test;

public class Client {
    @Test
    public void ProxyTest(){
        Demo demo = new DemoImpl();
        // 实例化InvocationHandler
        CacheProxy invocationHandler = new CacheProxy(demo);

        // 根据目标对象生成代理对象
        Demo proxy = (Demo) invocationHandler.getProxy();

        // 调用代理对象的方法
        proxy.addCache();

    }
}
